<?php

namespace yitongpay;

use app\common\model\CreditCashs;
use app\web\model\CreditBank;
use think\facade\Log;
use yitongpay\lib\YitongPayApi;

class YitongServer
{
    // 获取短信
    public function sendMessage($data)
    {
        return YitongPayApi::sendMessage($data);
    }

    // 短信签约
    public function quickSign($data)
    {
        return YitongPayApi::quickSign($data);
    }

    // 支付签约
    public function synonymNamePay($cash_id, $user_credit, $time, $ip)
    {
        $cash = CreditCashs::get($cash_id);
        $bank = CreditBank::get($cash->savings_bank_id);
        $cash['bank_name'] = $bank->bank_name;
        $result = YitongPayApi::synonymNamePay($cash, $user_credit, $time, $ip);
        return $result;
    }

    // 订单查询
    public function orderQuery($orderId, $date)
    {
        $data = [
            'merOrderNum' => $orderId,
            'tranDate' => $date
        ];
        return YitongPayApi::orderQuery($data);
    }

    // 对账下载
    public function loadFile()
    {
        $result =  YitongPayApi::loadFile('20180920');
        if($result['respCode'] == '0000') {
            return $result;
        }
        return false;
    }





}